package collections;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class Test1 {
    public static void main(String[] args) {

        // 批量为集合添加元素
        List<String> names = new ArrayList<>();
        Collections.addAll(names,"张三", "李四", "王五", "赵六");
        System.out.println(names);
        System.out.println("---------------------------------------------------");
        // 打乱集合中元素顺序
        Collections.shuffle(names);
        System.out.println(names);
        System.out.println("---------------------------------------------------");
        // 为集合中元素升序排序
        List<Integer> list = new ArrayList<>();
        list.add(56);
        list.add(29);
        list.add(133);
        list.add(7);
        Collections.sort(list);
        System.out.println(list);
    }
}
